-
Notifications
You must be signed in to change notification settings - Fork 582
deferrable epp function simplifying deferred templates #1253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This function will detect when it's passed a deferred function and will effectively defer itself rather than rendering a template directly. It does this by either returning a deferred inline_epp function with the template source and variables compiled into the catalot, or by rendering directly with epp and just returning that output.
I think this is the right UX for the purpose; basically an arg-for-arg wrapper for Wild future improvement idea: If we like this idea, there's a possibility we could modify the internals a bit to sub out the deferred arguments for |
@binford2k Looks like you have a failing lint check
Also I wonder if we should have a spec test for this? |
end | ||
it { | ||
foo = Puppet::Pops::Types::TypeFactory.deferred.create('join', [1,2,3]) | ||
is_expected.to run.with_params('mymod/template.epp', {'foo' => foo }) #.and_return(a_kind_of Puppet::Pops::Evaluator::DeferredValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joshcooper I couldn't quite get the return type here. Suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind. I figured out the return type and submitted an rspec-puppet PR to actually allow this matcher to work.
PR puppetlabs#637 uses stdlib::deferrable_epp that is only available in v8.4.0[1] [1] puppetlabs/puppetlabs-stdlib#1253 Change-Id: I455cec0ec1c6a2ec63b2ab0c19b2b7a2119f2f26
No description provided.